package com.yh.controller;

import com.yh.common.BaseResult;
import com.yh.service.IAuthService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 注册 登录
 * @author yh
 */
@RestController
@RequestMapping("/auth")
@AllArgsConstructor
public class AuthController {
    private final IAuthService authService;

    @PostMapping("/login")
    public BaseResult login(String username,String password){
        Object user = authService.login(username,password);
        return BaseResult.success(user);
    }

    @PostMapping("/register")
    public BaseResult register(Object o){
        Object user = authService.register(o);
        return BaseResult.success(user);
    }
}
